#include "BitDefine.h"
#include "SignalDefine.h"
#include "BSP_Config.h"
#include "BSP.h"
#include "IO.h"

static const IO_T sigIOs[Sig_MAX] = {
	[Sig_LED] = IO_INIT_TABLE(SIG_LED_GP, SIG_LED_PIN),
	[Sig_BUZ] = IO_INIT_TABLE(SIG_BUZ_GP, SIG_BUZ_PIN),
	[Sig_TAMP] = IO_INIT_TABLE(SIG_TAMP_GP, SIG_TAMP_PIN),
	[Sig_WG] = IO_INIT_TABLE(SIG_WG_GP, SIG_WG_PIN),
};

void BSP_Signal_Init(void){
	int i;

	for(i = 0; i < Sig_MAX; i++){
		IO_Init(&sigIOs[i], IO_Mode_IPU);
	}
}

uint32_t BSP_Signal_Get(void){
	uint32_t sig = IO_MultGet(sigIOs, Sig_MAX);
	//TAMP高电平触发
	sig ^= (Bit(Sig_LED) | Bit(Sig_BUZ) | Bit(Sig_WG));
	return sig;
}


